﻿
----------------------------------------------------------------------------------------------------
------------------------------- USER1 - Claims -----------------------------------------------------
------------------------- HAS PERMISSIONS FOR Read,Create,Update,Delete on Resource 'Physician' ------
GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 1 AND ResourceId = 1 AND ClaimTypeId = 1)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(1,1,1)
END
GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 1 AND ResourceId = 1 AND ClaimTypeId = 2)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(1,1,2)
END

GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 1 AND ResourceId = 1 AND ClaimTypeId = 3)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(1,1,3)
END

GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 1 AND ResourceId = 1 AND ClaimTypeId = 4)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(1,1,4)
END


----------------------------------------------------------------------------------------------------
------------------------------- USER2 - Claims -----------------------------------------------------
------------------------- HAS PERMISSIONS FOR Read,Create,Update,Delete on Resource 'Patient' ------
GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 2 AND ResourceId = 2 AND ClaimTypeId = 1)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(2,2,1)
END
GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 2 AND ResourceId = 2 AND ClaimTypeId = 2)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(2,2,2)
END

GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 2 AND ResourceId = 2 AND ClaimTypeId = 3)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(2,2,3)
END

GO
IF NOT EXISTS (SELECT UserId FROM UserClaims WHERE UserId = 2 AND ResourceId = 2 AND ClaimTypeId = 4)
BEGIN
INSERT INTO UserClaims(UserId,ResourceId,ClaimTypeId)
     VALUES(2,2,4)
END

